<%@ page language="java" import="java.util.*,java.sql.*"
	pageEncoding="utf-8"%>
<%@page import="com.bean.LoginBean"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'lzsq.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

</head>

<body>
	<%
		Class.forName("com.mysql.jdbc.Driver").newInstance();
		String url = "jdbc:mysql://localhost:3306/graduatedesign";
		String user = "root";
		String password = "root";
		LoginBean LoginBean = (LoginBean) session.getAttribute("Loginbean");
		String username = LoginBean.getUsername();
		Connection conn = DriverManager.getConnection(url, user, password);
		Statement sm = conn.createStatement();
		ResultSet rs = sm
				.executeQuery("select lizhi,reason,jiaojie,dept,isallow from lizhi   where username='"
						+ username + "'");
		rs.next();
	%>

	<form name="f1" method="post" action="lzsq" onsubmit="return ck()">
		<table width="100%" border="0" cellpadding="0" cellspacing="1"
			bgcolor="#BBD3EB">

			<tr>
				<td height="27" align="center"
					background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">预计离职日期</td>

				<%
					if (rs.first()) {
				%>
				<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp; <input type="text"
					id="lizhi" name="lizhi" size="50" readonly="readonly"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});"
					value="<%=rs.getString(1)%>" /> <script type="text/javascript"
						src="/OA/My97DatePicker/WdatePicker.js"></script>
				</td>
				<%
					} else {
				%>
				<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp; <input type="text"
					id="lizhi" name="lizhi" size="50" readonly="readonly"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" /> <script
						type="text/javascript"
						src="/OA/My97DatePicker/WdatePicker.js"></script>
				</td>
				<%
					}
				%>
			</tr>
			<tr>
				<td height="200px" align="center" background="/OA/admin/images/index1_72.gif">原因</td>
				<%
					if (rs.first()) {
				%>
				<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<textarea id="jingyan"
						name="reason" style="width:400px; height:200px"><%=rs.getString(2)%></textarea>
				</td>
				<%
					} else {
				%>
				<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<textarea id="jingyan"
						name="reason" style="width:400px; height:200px"></textarea>
				</td>
				<%
					}
				%>
			</tr>
			<tr>
				<td height="27" align="center"
					background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">离职交接</td>
				<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp; 
				<%
 					if (rs.first()) {
 				%> <input
					type="text" id="jiaojie" name="jiaojie" size="80"
					value="<%=rs.getString(3)%>" /></td>
				<%
					} else {
				%>
				<input type="text" id="jiaojie" name="jiaojie" size="80" />
				</td>
				<%
					}
				%>
			</tr>
			<%
				if (rs.first()) {
			%>

				<%
				if (rs.getString(5).equals("同意")) {
			%>
			<tr>
				<td height="27" align="center"
					background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">审批状态</td>
				<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<a>同意离职，我们很遗憾失去您这个人才&nbsp;&nbsp;&nbsp;
			</tr>
				<%
				} else {
			%>
			<tr>
				<td height="27" align="center"
					background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">审批状态</td>
				<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<a><%=rs.getString(5)%>&nbsp;&nbsp;&nbsp;<a href="lzsqdid?username=<%=username%>" onclick="alert('撤销成功')">撤销申请</a>
				</td>
			</tr>
			<%} %>
			<%
				} else {
			%>
			<tr>
				<td height="27" align="center"
					background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF"></td>
				<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<input type="submit"
					value="提交" /><input type="reset" value="重置" /></td>
			</tr>
			<%
				}
			%>
			<script language="javascript">
				function ck() {
					if (f1.jingyan.value == "") {
						alert("掌握技能和工作不能为空");
						return false;
					}
					if (f1.ruzhi.value == "") {
						alert("入职时间不能为空");
						return false;
					}
				}
			<%String suc = (String) request.getAttribute("suc");
			if (suc != null) {%>
				alert("操作成功");
				location.replace("/Login/admin/lzsq.jsp");
			<%}%>
				
			</script>
		</table>
	</form>

</body>
</html>
